# Contributor: Damian Kurek <starfire24680@gmail.com>
# Maintainer: Damian Kurek <starfire24680@gmail.com>
pkgname=kodi-game-libretro-mame2000
pkgver=0.37.0.32
_realname=Nexus
pkgrel=0
pkgdesc="MAME 2000 GameClient for Kodi"
options="!check" # no test suite
url="https://github.com/kodi-game/game.libretro.mame2000"
arch="x86_64 armv7" # kodi is available only on these architectures
#aarch64: blocked by libretro-mame2000 (why?)
license="custom"
makedepends="cmake kodi-dev samurai"
depends="kodi-game-libretro libretro-mame2000"
source="$pkgname-$pkgver-$_realname.tar.gz::https://github.com/kodi-game/game.libretro.mame2000/archive/$pkgver-$_realname.tar.gz"
builddir="$srcdir/game.libretro.mame2000-$pkgver-$_realname"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_MODULE_PATH=/usr/lib/cmake/kodi
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	rm -r "$pkgdir"/usr/lib/kodi/addons/game.libretro.mame2000/game.libretro.mame2000.so
	ln -s /usr/lib/libretro/mame2000_libretro.so \
		"$pkgdir"/usr/lib/kodi/addons/game.libretro.mame2000/game.libretro.mame2000.so
}

sha512sums="
23cd9cebfc222d49d16e820b508fe4303a9f3429f625aa64a3b68ee11264bf887b4172d7cf3d30000a936927e5da59105cc4d4e815f762ae0afd960115f7bc27  kodi-game-libretro-mame2000-0.37.0.32-Nexus.tar.gz
"
